import { Point } from '../geometry/point';
import { BaseGeometry } from '../geometry/basegeometry';
import { RectGeometry } from '../geometry/rectgeometry';
import { EllipseGeometry } from '../geometry/ellipsegeometry';
/**
 * 橡皮擦形状
 */
export abstract class EraserShape {
    private _width: number;
    private _height: number;
    constructor(width: number, height: number) {
        this._width = width;
        this._height = height;
    }
    get width() {
        return this._width;
    }
    get height() {
        return this._height;
    }
    /**
     * 获取以指定点为中心的几何图形
     * @param centerPoint 
     */
    abstract getGeometry(centerPoint: Point): BaseGeometry;
}
/**
 * 矩形橡皮擦
 */
export class RectEraserShape extends EraserShape {
    constructor(width: number, height: number) {
        super(width, height);
    }
    /**
     * 获取以指定点为中心的几何图形
     * @param centerPoint 
     */
    public getGeometry(centerPoint: Point): BaseGeometry {
        const x = centerPoint.x - this.width / 2;
        const y = centerPoint.y - this.height / 2;
        return new RectGeometry(x, y, this.width, this.height);
    }
}
/**
 * 圆形橡皮擦
 */
export class EllipseEraserShape extends EraserShape {
    constructor(width: number, height: number) {
        super(width, height);
    }
    /**
     * 获取以指定点为中心的几何图形
     * @param centerPoint 
     */
    public getGeometry(centerPoint: Point): BaseGeometry {
        const x = centerPoint.x - this.width / 2;
        const y = centerPoint.y - this.height / 2;
        return new EllipseGeometry(x, y, this.width, this.height);
    }
}